package cn.jiyun.mapper;

import cn.jiyun.pojo.Project;
import cn.jiyun.result.QueryPageBean;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface ProjectMapper {

    /*@Select("select * from project where flag=1 limit #{currentPage},#{pageSize}")*/
    /*List<Project> findPage(@Param("currentPage") int currentPage,@Param("pageSize") Integer pageSize);*/

    @Select("select count(1) from project where flag=1")
    int jilu();

    @Insert("INSERT INTO `project` (`pname`,  `starttime`,  `endtime`, `updatetime`, `did`, `cid`) VALUES (#{pname},#{starttime},#{endtime},#{updatetime},#{did},#{cid})")
    int add(Project project);

    @Update("update project set flag=0 where pid=#{pid}")
    void delete(Integer pid);

    @Select("select * from project where pid=#{pid}")
    List<Project> findById(Integer pid);

    @Update("UPDATE  project SET  pname = #{pname},  starttime = #{starttime},  endtime = #{endtime},  updatetime = #{updatetime},  did = #{did},  cid = #{cid} WHERE pid = #{pid}")
    int edit(Project project);

    List<Map> findPage(@Param("currentPage") int i,@Param("pageSize") Integer pageSize,@Param("queryString") String queryString);

    @Select("select * from project where flag=1")
    List<Project> init3();

    @Update("update project set did=#{did} where pid=#{pid}")
    int flag(@Param("did") String did,@Param("pid") int pid);



}
